<?php
class Education_model extends MY_Model{

    function __construct()
    {
        parent::__construct();
        $this->_table        =    'educations';   //ten table trong db
        $this->primary_key    =    'id';     //khoa chinh
    }
    
    function Years_to_University($birth,$gender)
    {
    	$current_year	=	date('Y');
    	$birth_year		=	date('Y',strtotime($birth));
    	$year_university	=	0;
    	$paramter	=	$this->data['paramter'];
    	if($paramter)
    	{
	    	if($gender=='Male'){
	    		$year_university	=	intval($birth_year+$paramter->university_entry_age_for_male-$current_year);
	    	}
	    	else{
	    		$year_university	=	intval($birth_year+$paramter->university_entry_age_for_female-$current_year);
	    	}
    	}
    	return $year_university;
    }
}